Storage Migration
2016/05/17 |
This is the example to use Storage Migration function for virtual machines.
The different point of Storage Migration from Live Migration is that Storage Migration does not need a Storage server
which has virtual machine images, when executing Storage Migration, virtual machine image on a KVM host is migrated
on another KVM host like follows.
Storage Migration <-------------------> +----------------------+ +----------------------+ | [ KVM Host #1 ] |10.0.0.21 10.0.0.22| [ KVM Host #2 ] | | +---------------------+ | | kvm01.srv.world | | kvm02.srv.world | +----------------------+ +----------------------+ |
[1] |
Create a virtual machine on a KVM host.
|
[2] | Show the file size of a virtual machine image like follows on a KVM host and move to another KVM host, create a empty disk space like follows. |
# show the size of Virtual machine root@kvm01:~# ll /var/kvm/images total 846468 -rwxr-xr-x 1 root root 32212254720 Aug 6 22:00 ubuntu.img ### on another KVM host ### # create a disk space which is the same size of a virtula machine root@kvm02:~# fallocate -l 32212254720 /var/kvm/images/ubuntu.img root@kvm02:~# ll /var/kvm/images total 31457284 -rw-r--r-- 1 root root 32212254720 Aug 6 22:10 ubuntu.img |
[3] | It's OK all, execute Storage Migration like follows. |
root@kvm01:~# virsh list Id Name State -------------------------------------- 2 ubuntu running
root@kvm01:~#
root@kvm01:~# virsh migrate --live --copy-storage-all ubuntu qemu+ssh://10.0.0.22/system root@10.0.0.22's password: virsh list Id Name State -------------------------------------- # just migrated
### on another KVM host ### root@kvm02:~# virsh list Id Name State --------------------------------------- 1 ubuntu running # back to another host, it's OK to execute normal Live Migration root@kvm02:~# virsh migrate --live ubuntu qemu+ssh://10.0.0.21/system root@10.0.0.21's password: virsh list Id Name State -------------------------------------- |